CC=gcc
LD=gcc

CFLAGS=-Wall -O2 -g
LDFLAGS=
CINCLUDES=-I. 
LIBS=-lrt -lm -lpthread -lcblas
GLIBS=-lGL -lGLU -lglut 
SRCSC= voslam_geo.c voslam_bookkeep.c voslam_calc.c voslam_image.c voslam_util.c voslam_blas.c 
OBJSC=$(SRCSC:.c=.o)

COMPILEC=$(CC) $(CFLAGS) $(CINCLUDES) -c
LINK=$(LD) $(LDFLAGS)

all: voslam_stereo gl_voslam_stereo gl_voslam_mono voslam_mono

voslam_stereo:  voslam_stereo.o $(OBJSC)
	$(LINK) -o $@ voslam_stereo.o  $(OBJSC) $(LIBS)
gl_voslam_stereo:  gl_voslam_stereo.o  $(OBJSC)
	$(LINK) -o $@ gl_voslam_stereo.o $(OBJSC) $(LIBS) $(GLIBS)
gl_voslam_mono:  gl_voslam_mono.o  $(OBJSC) jpeg_read.o
	$(LINK) -o $@ gl_voslam_mono.o $(OBJSC) $(LIBS) $(GLIBS) jpeg_read.o -ljpeg
voslam_mono:  voslam_mono.o  $(OBJSC) jpeg_read.o
	$(LINK) -o $@ voslam_mono.o $(OBJSC) $(LIBS)  jpeg_read.o -ljpeg
	
## Compile rule for all .o (.c) file
%.o:    %.c
	$(COMPILEC) -o $@ $<
clean:
	rm -f *.o voslam_stereo gl_voslam_stereo gl_voslam_mono voslam_mono
